<?xml version="1.0" encoding="UTF-8"?>

<ui:component xmlns="http://www.w3.org/1999/xhtml"
              xmlns:ui="http://java.sun.com/jsf/facelets"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:rich="http://richfaces.org/rich"
              xmlns:c="http://java.sun.com/jstl/core"
              xmlns:gouse="http://www.ganymed.be/gouse/functions"
              xmlns:a4j="http://richfaces.org/a4j">

    <rich:modalPanel id="modalConfirmLogOut" width="450" height="115">
        <f:facet name="header">
            <h:panelGroup>
                <h:outputText value="#{applicationResourceBundle['message.logout.confirm']}"/>
            </h:panelGroup>
        </f:facet>
        <table>
            <tbody>
            <tr>
                <td colspan="3">
                    <h:outputText value="#{applicationResourceBundle['message.logout.confirm.elaborate']}"/>
                </td>
            </tr>
            <tr>
                <td/>
                <td/>
                <td align="right">
                    <a4j:commandButton id="logoutConfirmLink"
                                       value="#{applicationResourceBundle['navigation.logout.confirm']}"
                                       onclick="window.location='#{request.contextPath}/swf/logout-flow';return false;"/>
                    <f:verbatim>&#0160;</f:verbatim>
                    <a4j:commandButton id="logoutCancelLink"
                                       value="#{applicationResourceBundle['navigation.logout.cancel']}"/>
                </td>
            </tr>
            </tbody>
        </table>
        <rich:componentControl for="modalConfirmLogOut"
                               attachTo="logoutCancelLink"
                               operation="hide"
                               event="onclick"/>
        <rich:componentControl for="logoutCancelLink"
                               attachTo="logoutConfirmLink"
                               operation="hide"
                               event="onclick"/>
    </rich:modalPanel>

    <table width="100%" cellpadding="0" cellspacing="0" border="0" style="margin-bottom: 2em">
        <tr>
            <td colspan="3">
                <c:if test="#{gouse:isUserKnown()}">
                    <div id="blueblock">
                        <ul class="navigation">
                            <h:form id="sidePanelForm">
                                <c:forEach items="#{utilBackingBean.sidePanelFunctions}" var="function">
                                    <li class="navigation_item">
                                        <h:outputLink value="#{request.contextPath}#{function.url}">#{function.name}
                                        </h:outputLink>
                                    </li>
                                </c:forEach>

                                <li class="navigation_item">
                                    <h:outputLink value="#" id="modalLink">
                                        #{applicationResourceBundle['navigation.logout.title']}
                                        <rich:componentControl for="modalConfirmLogOut" attachTo="modalLink"
                                                               operation="show" event="onclick"/>
                                    </h:outputLink>
                                </li>
                            </h:form>
                        </ul>
                    </div>
                </c:if>
            </td>
        </tr>
    </table>

</ui:component>

